#ifndef RWrapDefs_H
#define RWrapDefs_H

#ifdef WIN32
#ifdef RWRAP_EXPORTS
#define RWRAP_API __declspec(dllexport)
#else
#define RWRAP_API __declspec(dllimport)
#endif
#else
#define RWRAP_API
#endif

#define RWRAP_CALL __cdecl


#include <vector>
#include <string>

#include "Stream/ugdefs.h"
#include "Geometry/UGGeometry.h"

using namespace UGC;
using namespace std;

#ifdef __cplusplus  
extern "C" { 
#endif

struct RWRAP_API Wrap_Geometrys
{
	UGGeometry** pGeos;
	UGint nCount;
};

union VarValue
{
	OgdcUchar bVal;
	OgdcShort sVal;
	OgdcInt	iVal;
	OgdcLong  lVal;
	OgdcFloat fVal;
	OgdcDouble dVal;
	char* pValue;
};

struct RWRAP_API Wrap_Value 
{
	VarValue vValue;
	UGVariant::VarType vType;
};

struct RWRAP_API Wrap_Field 
{
	char* name;
	Wrap_Value* value;
};

struct RWRAP_API Wrap_Feature{
	UGGeometry* pGeo;
	Wrap_Field** pFields;
	UGint nFieldCount;
};

struct RWRAP_API Wrap_Records{
	Wrap_Feature** pFeature;
	UGint nCount;
};

struct  RWRAP_API Wrap_Pixels
{
	UGlong nWidth;
	UGlong nHeight;
	UGdouble* pxs;
	UGdouble* pys;
	UGdouble* pvs;
};

RWRAP_API void RWRAP_CALL wrap_delete_primitive(void* p);

RWRAP_API void RWRAP_CALL wrap_delete_primitive_ary(void* p);

RWRAP_API void RWRAP_CALL wrap_delete_wchar_ary(const wchar_t* p);

RWRAP_API void RWRAP_CALL wrap_delete_char_ary(const char* p);

RWRAP_API wchar_t* RWRAP_CALL cpywstr(const wchar_t* p);

RWRAP_API char* RWRAP_CALL CopyStr(const char* p);

RWRAP_API void RWRAP_CALL var2Value(const UGVariant* value, Wrap_Value* res);

struct Wrap_FieldInfo 
{
	char* name;
	char* caption;
	char* type;
	char* defaultValue;
	bool bSystem;
	bool bRequired;
	int maxLength;
};

struct Wrap_FieldInfos
{
	Wrap_FieldInfo** pFieldInfo;
	UGint nCount;
};


struct Wrap_RasterInfo
{
	UGlong nWidth;
	UGlong nHeight;
	double bounds[4];
	double dNoValue;
	char* pixelFormat;
};

RWRAP_API void RWRAP_CALL wrap_delete_FieldInfos(const Wrap_FieldInfos& p);

#ifdef __cplusplus
}

#endif


#endif